package com.becca.cake.service.goods;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.web.multipart.MultipartFile;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.coupon.GoodsActivityModel;
import com.becca.cake.model.goods.GoodsLableModel;
import com.becca.cake.model.goods.GoodsModel;
import com.becca.cake.model.goods.GoodsPictureModel;
import com.becca.cake.model.goods.GoodsPriceSizeModel;
import com.becca.cake.model.system.AdminDO;

/**
 * 
 * 商品管理Service接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author yellow
 * @date 2016年5月18日 下午9:24:09
 */
public interface IGoodsService {
    /**
     * 查询所有商品
     * @param map
     * @return
     * @throws Exception
     */
    List<GoodsModel> selectGoods(Map<String, Object> map) throws Exception;

    /**
     * 
     * 获取商品数据总条数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectGoodsCount(Map<String, Object> map) throws Exception;

    /**
     * 添加或修改商品信息
     * @param goodsModel
     * @throws Exception
     */
    void insertOrUpdateGoods(GoodsModel goodsModel, List<MultipartFile> files,
                             String fileFreeMaketPath, String fileTempPath, AdminDO adminDo)
                                                                                            throws Exception;

    /**
     * 下架商品
     * @param id
     * @throws Exception
     */
    void updGoodsStatusById(Integer goodsId, Integer goodsStatus, String trueName)
                                                                                  throws ServiceException;

    /**
     * 根据商品ID查找商品对象
     * @param goodsId
     * @return
     * @throws ServiceException
     */
    GoodsModel selectGoodsById(Integer goodsId) throws Exception;

    /**
     * 根据商品ID查询商品PriceSize
     * @param goodsId
     * @return
     * @throws ServiceException
     */
    List<GoodsPriceSizeModel> queryGoodsPriceSizeByGoodsId(Map<String, Object> map)
                                                                                   throws ServiceException;

    /**
     * 
     * 获取配件数据总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long queryGoodsPriceSizeCount(Map<String, Object> map) throws ServiceException;

    /**
     * 添加或修改商品尺寸大小信息
     * @param goodsModel
     * @throws ServiceException
     */
    void addOrUpdGoodsPriceSize(GoodsPriceSizeModel goodsPriceSizeModel, String trueName)
                                                                                         throws ServiceException;

    /**
     * 根据商品尺寸编号查找商品对象
     * @param id
     * @return
     * @throws ServiceException
     */
    GoodsPriceSizeModel selectGoodsPriceSizeModelById(Integer id) throws ServiceException;

    /**
     * 修改isDelete
     * @param map
     * @throws ServiceException
     */
    void updIsDelete(Integer id, Integer isDelete, String trueName) throws ServiceException;

    /**
     * 
     * 获取商品图片数据总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long queryGoodsPicCount(Map<String, Object> map) throws ServiceException;

    /**
     * 根据商品图片编号查找图片对象
     * @param id
     * @return
     * @throws ServiceException
     */
    GoodsPictureModel selectGoodsPicById(Integer id) throws ServiceException;

    /**
     * 修改商品图片isDelete
     * @param map
     * @throws ServiceException
     */
    void updGoodsPicIsDelete(Integer id, Integer isDelete, String trueName) throws ServiceException;

    /**
     * 添加或修改商品图片
     * @param goodsPictureModel
     * @param files
     * @param fileTempPath
     * @param adminDo
     * @throws Exception
     */
    void insertOrUpdateGoodsPic(GoodsPictureModel goodsPictureModel, MultipartFile files,
                                String fileTempPath, AdminDO adminDo) throws Exception;

    /**
     * 查询商品图片
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsPictureModel> queryGoodsPics(Map<String, Object> map) throws Exception;

    /**
     * 上传图片文件
     * @param files
     * @param fileTempPath
     * @return
     * @throws Exception
     */
    String uploadPictureFile(MultipartFile files, String fileTempPath) throws Exception;

    /**
     * 批量修改排序
     * @param map
     * @throws DataAccessException
     */
    void updateGoodsPicOrders(String jsonList) throws ServiceException;

    /**
     * 查询商品活动列表
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsActivityModel> selectGoodsActivity(Map<String, Object> map) throws ServiceException;

    /**
     * 
     * 获取商品数据总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectGoodsActivityCount(Map<String, Object> map) throws ServiceException;

    /**
     * 添加或修改商品活动
     * @param insertGoodsDtail
     * @throws DataAccessException
     */
    void insertOrUpdateGoodsActivity(GoodsActivityModel goodsActivityModel, String trueName)
                                                                                            throws ServiceException;

    /**
     * 根据商品活动ID查询商品活动对象
     * @param id
     * @throws ServiceException
     */
    GoodsActivityModel selectGoodsActivityUpdById(Integer id) throws ServiceException;

    /**
     * 批量修改商品排序
     * @param jsonList
     * @throws ServiceException
     */
    void updateGoodsOrder(String jsonList, String userName) throws ServiceException;

    /**
     *  查询标签商品数据
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsLableModel> selectGoodsLable(Map<String, Object> map) throws ServiceException;

    /**
     * 获取查询标签商品总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectGoodsLableCount(Map<String, Object> map) throws ServiceException;

    /**
     * 添加、 修改标签信息
     * @param goodsLableModel
     * @throws DataAccessException
     */
    void addOrUpdateGoodsLable(GoodsLableModel goodsLableModel, AdminDO adminDo)
                                                                                throws ServiceException;

    /**
     * 删除标签商品应用
     * @param id
     * @throws DataAccessException
     */
    void deleteGoodsLableById(Integer id) throws ServiceException;

    /**
     * 根据商品标签编号查找标签对象
     * @param id
     * @return
     * @throws ServiceException
     */
    GoodsLableModel selectGoodsLableById(Integer id) throws ServiceException;

}
